See code here.
## Precision & Recall
# compute the average precision and sd
results <- list(res_ccd5psparse, res_fci5psparse, res_cci5psparse, res_ccd10psparse, res_fci10psparse, res_cci10psparse, res_ccd5pdense, res_fci5pdense, res_cci5pdense, res_ccd10pdense, res_fci10pdense, res_cci10pdense, res_ccd5pLV2, res_fci5pLV2, res_cci5pLV2, res_ccd10pLV, res_fci10pLV, res_cci10pLV) %>%
# transpose df
map(~ sjmisc::rotate_df(.x) %>%
# add sample size (N) info
rename_with(~paste0(.x, "N = ", rep(N, each=8))) %>%
# think about how to deal with NAs or do I want to define sth. else instead of NAs.
#na.omit(.x) %>%
summarise(across(everything(.), list(mean = ~mean(., na.rm=T), sd = ~sd(., na.rm=T))))) %>%
bind_rows() %>%
mutate(algorithm = rep(c("ccd", "fci", "cci"), 6),
condition = rep(c("5p_sparse", "10p_sparse", "5p_dense", "10p_dense", "5p_LV", "10p_LV"), each=3)) %>%
# brings the algorithm and condition names first
relocate(where(is.character), .before = where(is.numeric)) %>%
# convert itto a long format
tidyr::pivot_longer(!c(algorithm, condition), names_to = "metric", values_to = "value") %>%
# Add sample size column (N) & clean up the column name
mutate(N = stringr::str_extract(metric, "(?<=[N =])\\d+"),
metric = stringr::str_replace_all(metric, "[0-9.]+|[N =]", ""))
## Uncertainty
uncertainties <- bind_rows("ccd_5p-sparse" = uncer_ccd5psparse, "fci_5p-sparse" = uncer_fci5psparse, "cci_5p-sparse"=uncer_cci5psparse, "ccd_10p-sparse"=uncer_ccd10psparse, "fci_10p-sparse" = uncer_fci10psparse, "cci_10p-sparse" = uncer_cci10psparse, "ccd_5p-dense"=uncer_ccd5pdense, "fci_5p-dense"=uncer_fci5pdense, "cci_5p-dense"=uncer_cci5pdense, "ccd_10p-dense"=uncer_ccd10pdense, "fci_10p-dense"=uncer_fci10pdense, "cci_10p-dense"=uncer_cci10pdense, "ccd_5p-LV"=uncer_ccd5pLV2, "fci_5p-LV"=uncer_fci5pLV2, "cci_5p-LV"=uncer_cci5pLV2, "ccd_10p-LV"=uncer_ccd10pLV, "fci_10p-LV"=uncer_fci10pLV, "cci_10p-LV"=uncer_cci10pLV, .id="id") %>%
group_by(id) %>%
summarise_all(list(mean = mean, sd = sd)) %>%
mutate(algorithm = stringr::str_split(id, "_", simplify = T)[,1],
condition = stringr::str_split(id, "_", simplify = T)[,2]) %>%
tidyr::pivot_longer(!c(algorithm, condition, id), names_to = "name", values_to = "value") %>%
mutate(N = stringr::str_extract(stringr::str_split(name, "_", simplify = T)[,1], "(\\d)+"),
statistics = stringr::str_split(name, "_", simplify = T)[,2]) %>%
dplyr::select(-id, -name) %>% relocate(where(is.character), .before = where(is.numeric))
## SHD
SHDs <- bind_rows("ccd_5p-sparse" = SHD_ccd5psparse, "fci_5p-sparse" = SHD_fci5psparse, "cci_5p-sparse"=SHD_cci5psparse, "ccd_10p-sparse"= SHD_ccd10psparse, "fci_10p-sparse" = SHD_fci10psparse, "cci_10p-sparse" = SHD_cci10psparse, "ccd_5p-dense"= SHD_ccd5pdense, "fci_5p-dense"=SHD_fci5pdense, "cci_5p-dense"=SHD_cci5pdense, "ccd_10p-dense"= SHD_ccd10pdense, "fci_10p-dense"=SHD_fci10pdense, "cci_10p-dense"=SHD_cci10pdense, "ccd_5p-LV"=SHD_ccd5pLV2, "fci_5p-LV"=SHD_fci5pLV2, "cci_5p-LV"=SHD_cci5pLV2, "ccd_10p-LV"=SHD_ccd10pLV, "fci_10p-LV"=SHD_fci10pLV, "cci_10p-LV"=SHD_cci10pLV, .id="id") %>%
group_by(id) %>%
summarise_all(list(mean = mean, sd = sd)) %>%
mutate(algorithm = stringr::str_split(id, "_", simplify = T)[,1],
condition = stringr::str_split(id, "_", simplify = T)[,2]) %>%
tidyr::pivot_longer(!c(algorithm, condition, id), names_to = "name", values_to = "value") %>%
mutate(N = stringr::str_extract(stringr::str_split(name, "_", simplify = T)[,1], "(\\d)+"),
statistics = stringr::str_split(name, "_", simplify = T)[,2]) %>%
dplyr::select(-id, -name) %>% relocate(where(is.character), .before = where(is.numeric))